The present invention relates to data storage devices, and more particularly to a method for rewriting data stored in a nonvolatile memory.
Devices using various types of media, such as optical disks, magnetic tapes, and semiconductor memories, are known as data storage devices. Among them, hard disk drives (hereinafter referred to as “HDDs”) have become popular as storage devices for computers to such an extent that they are one type of the storage devices indispensable for today's computer systems. Further, not limited to computers, their application is widening more and more due to the superior characteristics with the advent of moving picture recording/reproducing devices, car navigation systems, removable memories for digital cameras and so on.
A magnetic disk used in an HDD has a plurality of tracks that are concentrically formed. Each track is partitioned into a plurality of sectors (servo sectors). Servo data and user data are written to each servo sector. Here, the user data written to each servo sector ranges over a plurality of sectors (data sectors). A head element moves according to servo data. As a result, data can be written to or read from a desired address. A signal read out from a magnetic disk by the head element through data read processing is subjected to waveform shaping, decoding processing and other prescribed signal processing by a signal processing circuit before the signal is transmitted to a host. The data transmitted from the host is also subjected to prescribed processing by the signal processing circuit in like manner before the data is written to the magnetic disk by the head element.
Microcodes for controlling an HDD are in general stored in a nonvolatile ROM. A typical example of such a ROM is a flash memory. The flash memory is electrically rewritable, and is effective in upgrading microcodes. Error correction of data stored in a flash memory is performed by ECC (Error Correction Code). However, because there is a limit to the error recovery by means of ECC (Error Check and Correct) processing, it is preferable to rewrite error bits.
Here, if the power is turned OFF while data is rewritten to a flash memory, there arises a problem in that the data is not correctly rewritten, or that data stored in the flash memory is lost. Therefore, it is necessary to take measures against the possibility that the power may be turned OFF while data is written to a flash memory. For example, patent document 1 (Japanese Patent Laid-open No. 2001-344156) discloses a technique relating to flash memories that are generally used for rewriting. In this technique, there is provided a flash memory and nonvolatile storing means that is different from the flash memory. The nonvolatile storing means includes a flag area for storing a write state indicating how writing to a storage area of the flash memory is performed. By flagging rewritten blocks in a stage in which rewriting is completed, it is possible to check whether or not writing to the flash memory by download has been successfully completed.